function [R1,R2,R]=tsk_type2(X,M1,M2,sigma,C);
R1=[];
R2=[];
[L,n]=size(X);
[m,n]=size(M1);


parfor i=1:L
U=[];
MU1=[];
UU=[];
LL=[];
for j=1:m
Uu=1;
Ll=1;
for t=1:n
P=[sigma(j,t),M1(j,t),M2(j,t)];
[uu,ll]=gausstype2(X(i,t),P);
Uu=Uu*uu;
Ll=Ll*ll;
end
UU=[UU,Uu];
LL=[LL,Ll];
end


c0=C(:,1);
for t=1:n
c0=c0+C(:,t+1)*X(i,t);
end

s=zeros(m,1);

h=(UU+LL)/2;
delta=UU-h;
[l_out,r_out] = interval_wtdavg(c0',s',h,delta);


R1=[R1,l_out];
R2=[R2,r_out];
end

R=(R1+R2)/2;